#ifndef	__BFX_REFXMLDOCUMENTTYPE_H__
#define	__BFX_REFXMLDOCUMENTTYPE_H__

namespace BFX
{

//////////////////////////////////////////////////////////////////////////////

// Contains information associated with the document type declaration.
class REFXMLDocumentType : public REFXMLLinkedNode
{
	friend class REFXMLDocument;
	friend class REFXMLLoader;
protected:
	REFXMLDocumentType(const UniString& strName, const UniString& strPublicId, const UniString& strSystemId, const UniString& strInternalSubset, REFXMLDocument* pDoc);
public:
	virtual ~REFXMLDocumentType();

	// Gets the name of the node.
	virtual UniString GetName() const;
	// Gets the name of the current node without the namespace prefix.
	virtual UniString GetLocalName() const;

	// Gets the type of the current node.
	virtual XMLNodeType GetNodeType() const;

	// Gets the collection of XmlEntity nodes declared in the document type declaration.
	REFXMLNodeMap* GetEntities() const;

	// Gets the collection of XmlNotation nodes present in the document type declaration.
	REFXMLNodeMap* GetNotations() const;

	//
	// DOM Level 2
	//

	// Gets the value of the public identifier on the DOCTYPE declaration.
	UniString GetPublicId() const;
	// Gets the value of the system identifier on the DOCTYPE declaration.
	UniString GetSystemId() const;
	// Gets the entire value of the DTD internal subset on the DOCTYPE declaration.
	UniString GtInternalSubset() const;

	// Saves the node to the specified XmlWriter.
	void WriteTo(REFXMLWriter* w) const;
	// Saves all the children of the node to the specified XmlWriter.
	void WriteContentTo(REFXMLWriter* w) const;

protected:
	bool IsParseWithNamespaces() const;
	void SetParseWithNamespaces(bool bNamespaces);

	REFXMLSchemaInfo* GetDtdSchemaInfo() const;
	void SetDtdSchemaInfo(REFXMLSchemaInfo* pSchemaInfo);

protected:
	UniString	m_strName;
	UniString	m_strPublicId;
	UniString	m_strSystemId;
	UniString	m_strInternalSubset;
	bool		m_bNamespaces;

	REF<REFXMLNodeMap>	m_pEntities;
	REF<REFXMLNodeMap>	m_pNotations;

	// parsed DTD
	REFXMLSchemaInfo*	m_pSchemaInfo;
};

}	//	namespace BFX

#endif	//	__BFX_REFXMLDOCUMENTTYPE_H__
